<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>订单</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet"
	href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script
	src="https://lib.sinaapp.com/js/jquery/2.0.2/jquery-2.0.2.min.js"></script>
<script
	src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script
	src="https://cdn.staticfile.org/popper.js/1.15.0/umd/popper.min.js"></script>
<script
	src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
</head>
<body>
<script>

function go(){
	alert("订购成功，返回主页");
	document.getElementById("form").submit();
	
}


</script>
<%--       ${cookie.userId.value} --%>

	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title">房间预订</h3>
		</div>

             
		<div class="container">
			<h2>客房详情</h2>
			<form:form action="" method="post" modelAttribute="room">
				<table class="table table-striped">

					<tbody>
						<tr>
							<td><b>客房类型</b></td>
							<td>
<%-- 								<p>${roomType}</p> --%>
								<c:if test="${roomType == 0}"> <p>单人房</p></c:if>
						  <c:if test="${roomType == 1}">  <p>智能亲子房</p></c:if>
						  <c:if test="${roomType == 2}"> <p>豪华双床房</p></c:if>
						  <c:if test="${roomType == 3}"><p>阳光大床房</p></c:if>
						  <c:if test="${roomType == 4}">  <p>甄选榻榻米</p></c:if>
						  <c:if test="${roomType == 5}">  <p>行政房</p></c:if>
							</td>
						</tr>


						<tr>
							<td><b>介绍</b></td>
							<td>
								<c:if test="${roomType == 0}"> <p>房间里只有一张床，而房间里的配套设施（牙刷、牙膏、肥皂、梳子、一次性拖鞋等）都只有一套</p></c:if>
						  <c:if test="${roomType == 1}">  <p>房内的设施更加的具有可玩性和益智性</p></c:if>
						  <c:if test="${roomType == 2}"> <p>一个房间内有两张床，酒店内的一种用语房间里的配套设施（牙刷、牙膏、肥皂、梳子、一次性拖鞋等）都有两套</p></c:if>
						  <c:if test="${roomType == 3}"><p>主要区别于其他普通标准间的两或三张床，大床房只设一张大床，其余设施没有太大区别</p></c:if>
						  <c:if test="${roomType == 4}">  <p>榻榻米与日本的神道教宗教仪式和茶道都有密切联系，许多日本家庭的房屋中仍然至少有一间铺设塌塌米的房间</p></c:if>
						  <c:if test="${roomType == 5}">  <p>独立的客厅和卧室中均提供精美的房间装饰</p></c:if>
							</td>
						</tr>
						<tr>
							<td><b>原价</b></td>
							<td>
									<c:if test="${roomType == 0}"> <p>300元</p></c:if>
						  <c:if test="${roomType == 1}">  <p>400元</p></c:if>
						  <c:if test="${roomType == 2}"> <p>500元</p></c:if>
						  <c:if test="${roomType == 3}"><p>600元</p></c:if>
						  <c:if test="${roomType == 4}">  <p>700元</p></c:if>
						  <c:if test="${roomType == 5}">  <p>800元</p></c:if>
							</td>
						</tr>
						<tr>
							<td><b>现价</b></td>
							<td>
									<c:if test="${roomType == 0}"> <p>200元</p></c:if>
						  <c:if test="${roomType == 1}">  <p>300元</p></c:if>
						  <c:if test="${roomType == 2}"> <p>400元</p></c:if>
						  <c:if test="${roomType == 3}"><p>500元</p></c:if>
						  <c:if test="${roomType == 4}">  <p>600元</p></c:if>
						  <c:if test="${roomType == 5}">  <p>700元</p></c:if>
							</td>
						</tr>
					</tbody>
				</table>
			</form:form>
		</div>	

		<div class="container">
			<div class="row">
			<c:if test="${roomIds.size()==0}">
			<p style="text-align: center;">没有可订购房间<a href="/hotel/main">点击返回首页</a></p>
			</c:if>
				<c:if test="${roomIds.size()!=0}">
				<form:form class="form-horizontal" id="form" action="/before/reserve/insertInfo"
					modelAttribute="reserve" method="post">
					<!--在Bootstrap框架中要实现水平表单效果 -->
	<input id="reserveUserId" name="reserveUserId" class="form-control"  type="hidden" value="${userId}"  >

					<div class="form-group">
						<label for="reserveRoomId" class="col-sm-3 control-label">选择房间号:</label>
						<div class="col-sm-5">
								<form:select path="reserveRoomId" class="form-control">
		         				<form:options items="${roomIds}" />
		   					</form:select>
						</div>
					</div>
							<div class="form-group">
						<label for="reserveInName" class="col-sm-3 control-label">入住者姓名:</label>
						<div class="col-sm-5">
						<form:input path="reserveInName" class="form-control"/>
						</div>
					
					</div>
					<div class="form-group">
						<label for="reserveInTel" class="col-sm-3 control-label">入住者电话:</label>
						<div class="col-sm-5">
						<form:input path="reserveInTel" class="form-control"/>
						</div>
					
					</div>
							<div class="form-group">
						<label for="reserveInIdnum" class="col-sm-3 control-label">入住者身份证号:</label>
						<div class="col-sm-5">
						<form:input path="reserveInIdnum" class="form-control"/>
						</div>
					
					</div>
								<div class="form-group">
						<label for="reserveInTime" class="col-sm-3 control-label">入住日期:</label>
						<div class="col-sm-5">
						<input type="date" name="reserveInTime" class="form-control"/>
<%-- 						<form:input path="reserveInTime" class="form-control"/> --%>
						</div>
					
					</div>
										<div class="form-group">
						<label for="reserveOutTime" class="col-sm-3 control-label">离店日期:</label>
						<div class="col-sm-5">
						<input type="date" name="reserveOutTime" class="form-control"/>
<%-- 						<form:input path="reserveOutTime" class="form-control"/> --%>
						</div>
					
					</div>
					<div class="form-group">
						<label for="reservePrice" class="col-sm-3 control-label">订单金额:</label>
						<div class="col-sm-5">
						<c:if test="${roomType == 0}"> <input name="reservePrice" value="200" class="form-control" readonly="readonly"/></c:if>
						  <c:if test="${roomType == 1}">  <input name="reservePrice" value="300" class="form-control" readonly="readonly"/></c:if>
						  <c:if test="${roomType == 2}"> <input name="reservePrice" value="400" class="form-control" readonly="readonly"/></c:if>
						  <c:if test="${roomType == 3}"><input name="reservePrice" value="500" class="form-control" readonly="readonly"/></c:if>
						  <c:if test="${roomType == 4}">  <input name="reservePrice" value="600" class="form-control" readonly="readonly"/></c:if>
						  <c:if test="${roomType == 5}">  <input name="reservePrice" value="700" class="form-control" readonly="readonly"/></c:if>
					
						</div>
					
					</div>

					<div class="form-group">
						<div class="col-sm-offset-3 col-sm-10">
							<button  style="width: 180px;"
								class="btn btn-default " id="LoginButton" onclick="go()">立即订购</button>
							<b>房间不适合？<a href="/hotel/main">点击返回首页</a></b>
						</div>
					</div>
				</form:form>
				</c:if>
				${msg}
			</div>
		</div>
	</div>
</body>
</html>